﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TP01.TP
{
    class Correct
    {
        static public void Plural(LinkedListNode<string> words)
        {
            if (words != null)
            {
                if (words.Value.ToLower() == "les" || words.Value.ToLower() == "des")
                {
                    if (words.Next.Value.EndsWith("x"))
                    {
                        Plural(words.Next.Next);
                    }
                    else if (words.Next.Value.EndsWith("s"))
                    {
                        Plural(words.Next.Next);
                    }
                    else if (words.Next.Value.EndsWith("eau"))
                    {
                        words.Next.Value += "x";
                        Plural(words.Next.Next);
                    }
                    else 
                    {
                        words.Next.Value += "s";
                        Plural(words.Next.Next);
                    }
                }
                else
                {
                    Plural(words.Next);
                };
            }
            else { };
        }
        static public void WordWithApp(LinkedListNode<string> words)
        {
            if (words != null)
            {
                if (words.Value.StartsWith("app"))
                {
                    if (words.Value == "appaiser" || words.Value == "appercevoir" || words.Value == "appitoyer" || words.Value == "applanir" || words.Value == "applatir" || words.Value == "apposter" || words.Value == "appostropher" || words.Value == "asppurer")
                    {
                        words.Value = words.Value.Replace("pp", "p");
                        WordWithApp(words.Next);
                    }
                    else { WordWithApp(words.Next); }
                }
                else { WordWithApp(words.Next); }
            }
            else { }
        }
        static public void CheckDictionary(LinkedListNode<string> words)
        {
            // FIXME Add your code here
            // For this function you are free to do what you want
        }
    }
    
}
